package io.demo2_File流;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class Test3 {
    public static void main1(String[] args)throws Exception {
        FileInputStream fis=new FileInputStream("d:/1.txt");
        FileOutputStream fos=new FileOutputStream("d:/2.txt");
        int data;
        while ((data=fis.read())!=-1){
            fos.write(data);
        }
        fis.close();
        fos.close();
    }

    public static void main(String[] args)throws Exception {
        FileInputStream fis=new FileInputStream("d:/1.txt");
        FileOutputStream fos=new FileOutputStream("d:/2.txt");
        byte[]arr=new byte[3];
        int len;
        while ((len=fis.read(arr))!=-1){
            fos.write(arr,0,len);
        }
        fis.close();
        fos.close();
    }
}
